package br.ufrn.btest.criterias;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import br.ufrn.btest.exceptions.InvalidInputDataException;

public abstract class Criteria {

	private List<List<String>> parametersInputValues;
	
	public Criteria(List<List<String>> parametersInputValues) {
		this.parametersInputValues = parametersInputValues;
	}

	public List<List<String>> getParametersInputValues() {
		return parametersInputValues;
	}

	public void setParametersInputValues(List<List<String>> parametersInputValues) {
		this.parametersInputValues = parametersInputValues;
	}
	
	public Set<String> getCombinationsStrings() {
		List<List<String>> combinations;
		
		try {
			combinations = getCombinations();
		} catch (InvalidInputDataException e) {
			return new HashSet<String>();
		}
		
		Set<String> strings = new HashSet<String>();
		
		for (List<String> combination : combinations) {
			StringBuffer string = new StringBuffer("");
			int valueCount = 1;
			for (String value : combination) {
				if(valueCount < combination.size()) {
					string.append(value + " & ");
				} else {
					string.append(value);
				}
				valueCount++;
			}
			strings.add(string.toString());
		}
		return strings;
	}
	
	public abstract List<List<String>> getCombinations() throws InvalidInputDataException;
	
}
